<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
 <head>
  <title>链接</title>
  <t:base type="jquery,easyui,tools,DatePicker"></t:base>
   <script src="plug-in/jquery-plugs/form/jquery.form.js"></script>
   <script type="text/javascript" src="plug-in/Validform/js/Validform_v5.3.1_min_zh-cn.js"></script>
   <script type="text/javascript" src="plug-in/Validform/js/Validform_Datatype_zh-cn.js"></script>
   <script type="text/javascript" src="plug-in/Validform/js/datatype_zh-cn.js"></script>
   <link rel="stylesheet" href="plug-in/Validform/css/style.css" type="text/css">
   <link rel="stylesheet" href="plug-in/Validform/css/tablefrom.css" type="text/css">

   
  	<style>
  		.prevImg{
  			float:left;
  			margin:2px;
  		}
  		.prevImg a{
  			display: block;
    		text-align: center;
    		cursor:pointer;
    		color:rgb(0,162,212)
  		}
  	</style>
 </head>
 <body>
 
  <form id="formobj" enctype="multipart/form-data" action="processingServiceController.do?doAdd" name="formobj" method="post">
  		<input type="hidden" id="btn_sub" class="btn_sub">
  		<input type="hidden" id="id" name="id" value="${service.id}"/>
					 
		<table style="" cellpadding="0" cellspacing="1" class="formtable">
			<tbody>
				<tr>
					<td align="right">
						<label class="Validform_label">
							加工名称:
						</label>
					</td>
					<td class="value">
					    <input onkeypress="specialTextValidate()" id="title" name="title" type="text"  maxlength="100"
					     	 style="width: 350px" class="inputxt" value="${service.title }" datatype="*">
						<span class="Validform_checktip"></span>
						<label class="Validform_label" style="display: none;">加工名称</label>
					</td>
				</tr>
				
				<tr>
					<td align="right">
						<label class="Validform_label">
							加工内容:
						</label>
					</td>
					<td class="value">
					    <textarea onkeypress="specialTextValidate()"  name="contentDesc" datatype="*"  maxlength="500"
					     	 style="width: 350px" class="inputxt"  datatype="*">${service.contentDesc }</textarea>
						<span class="Validform_checktip"></span>
						<label class="Validform_label" style="display: none;">加工内容</label>
					</td>
				</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							加工要求:
						</label>
					</td>
					<td class="value">
					    <textarea onkeypress="specialTextValidate()"  name="requirement"  datatype="*" maxlength="200"
					     	 style="width: 350px" class="inputxt"  datatype="*">${service.requirement}</textarea>
						<span class="Validform_checktip"></span>
						<label class="Validform_label" style="display: none;">加工要求</label>
					</td>
				</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							申请人手机号:
						</label>
					</td>
					<td class="value">
					    <input onkeypress="numberValidate()"  name="applyCellphone"  datatype="*" maxlength="11"
					     	 style="width:200px" class="inputxt"  datatype="*" value="${service.applyCellphone}"/>
						<span class="Validform_checktip"></span>
						<label class="Validform_label" style="display: none;">手机号</label>
					</td>
				</tr>				
				<tr>
					<td align="right">
						<label class="Validform_label">
							选择加工教师:
						</label>
					</td>
					<td class="value"> 
                	     <input id="teacherId" name="teacherId" type="hidden"  value="${service.assignTeacher.id}">               
					     <input id="realName"  type="text" style="width: 150px" class="inputxt"  readonly="readonly" value="${service.assignTeacher.realName}">
					     <t:choose hiddenName="teacherId" hiddenid="id" url="teacherController.do?goSelect" name="teacherList"
                          icon="icon-search" title="选择" textname="realName" isclear="false" isInit="true"></t:choose>
					</td>
					
				</tr>
				<tr>
					<td align="right">
						<label class="Validform_label">
							加工图纸附件:
						</label>
					</td> 
					<td class="value"> 
		         		
		         		<c:if test="${service.designAttach != null }">
		         				<div id="prevImg${service.designAttach.id}">${service.designAttach.origFileName}</div>
		         				
		         				<a  class="del" id="del${service.designAttach.id}" onclick='deleteAttach(${service.designAttach.id})'>删&nbsp;除</a>
		         			  	 
		         		</c:if>
		         		
		         		 <div id="wrapper">
					        <div id="container">
					            <div id="uploader">
					                <div class="queueList">
					                    <div id="dndArea" class="placeholder">
					                        <div id="filePicker"></div>
					                        <p>将文件拖到这里，单次最多可选1张</p>
					                    </div>
					                </div>
					                <div class="statusBar" style="display:none;">
					                    <div class="progress">
					                        <span class="text">0%</span>
					                        <span class="percentage"></span>
					                    </div><div class="info"></div>
					                    <div class="btns">
					                        <div id="filePicker2"></div><div class="uploadBtn">开始上传</div>
					                    </div>
					                </div>
					            </div>
					        </div>
   						</div>
		           </td> 
			  </tr>			  
			</tbody>
		</table>
		</form> 		
 </body>
 
    
   <!-- 上传文件  -->
    <link rel="stylesheet" type="text/css" href="plug-in/webUploader/css/webuploader.css" />
    <link rel="stylesheet" type="text/css" href="plug-in/webUploader/style.css" />
    <script type="text/javascript" src="plug-in/webUploader/dist/webuploader.js"></script>
    <script type="text/javascript" src="plug-in/webUploader/upload.js"></script>  
    
 	<script type="text/javascript">
			
			 $(document).ready(function () {
			 
				$('#filePicker2').hide();
				 
				var validForm = $('#formobj').Validform({tiptype:"3"}); //初始化校验form控件 
				
				// ajaxSubmit
				$("#btn_sub").click(function () {
					var valid = validForm.check(false);
					if(!valid) return;
					
				     $("#formobj").ajaxSubmit({success: function (data) {
				    	data = $.parseJSON(data);
				        if(data.success){
				        	window.top.tip("保存成功！");
				        	frameElement.api.opener.reloadTable();
				        	frameElement.api.close();
				        	
				        }else{
				        	tip(data.msg);
				        }
					 }});
				});
				
				if(location.href.indexOf("load=detail")!=-1){
					$('.del').remove();	
				}
				 
			});
			
			function  uploaderReady(){
				window.uploader.options.fileNumLimit =1;
			}
			 
			function deleteAttach(id){
				 $('#prevImg'+id).remove();
				 $('#del'+id).remove();
				 $('#formobj').append("<input type='hidden' name='deletedAttach'  value='"+id+"'/>");
			}
		 
		</script>
 